/*
 * SvrTask.h
 *
 *  Created on: 2012-7-11
 *      Author: ThinkPad
 */

#ifndef SVRTASK_H_
#define SVRTASK_H_

#include "SvrConfig.h"
#include "smart_lock.h"
#include "link_list.h"
#include "http.h"
#include "io_buf.h"
#include "SvrFileManage.h"

#define IP_LEN 32
/*
*svr run live status
*/
enum Svr_Run_Status
{
    SV_NONE = 0,
    SV_INIT = 1,
    SV_HEARTBEAT = 2,
    SV_CLOSE = 3
};
/*
*task status
*/
enum TASK_STATUS
{
    TASK_CLOSE,
    TASK_RUN
};
/*
*task flag
*/
enum TASK_FLAG
{
    TASK_NONE,
    TASK_MARKER,
    TASK_ADD,
    TASK_DEL
};

/*
 * server task class
 */
class SvrTask
{
public:
    SvrTask();
    ~SvrTask();

    Svr_Run_Status  Status;
    TASK_STATUS     svr_heartbeat_task;

public:
    /**
     * init class
     */
    int init(SvrConfig * pconfig,Svr_log * plog,SvrFileManage * psvrfilemanage);

    /*
    *svr heartbeat data handle
    */
    int handle_heartbeat_data(char * buf,size_t buf_len);

protected:


private:
    SvrConfig  * pSvrconfig;
    Svr_log	   * pSvrlog;
    SvrFileManage * pSvrFileUtils;
};

#endif /* SVRTASK_H_ */
